package com.cj.MyAspects;


import com.cj.models.ResultModel;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class GlobalAspect {
    @Pointcut("execution(public * com.cj.MyHttp.MyHttp.*(..))")
    public void web(){}
    @Before("web()")
    public void before()  {
        System.out.println("before");
    }

    @Around("web()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
       Object[] args= point.getArgs();

       return new ResultModel("success",point.proceed(args));
    }

}
